module.exports = (app) => {
  const { Schema, createModel, getModelName, formatDate, pre } = app.jax.mongoose
  const modelName = getModelName(__filename)

  const modelSchema = new Schema({
    title: String, // 活动标题

    storeId: Schema.Types.ObjectId,

    activityDate: { type: Date, get: (date) => formatDate(date, 'YYYY-MM-DD') }, // 活动日期
    startTime: { type: Date, get: (date) => formatDate(date, 'HH:mm') },
    endTime: { type: Date, get: (date) => formatDate(date, 'HH:mm') },

    adminId: Schema.Types.ObjectId,
    userId: Schema.Types.ObjectId, // 用户ID

    status: { type: Number, default: 0 }, // 活动状态（0、待预约 1、已被预约）
  })

  const Model = createModel(modelName, modelSchema)

  return Model
}
